package com.techblor.wechat.library.api;

import com.alibaba.fastjson.JSON;
import com.techblor.wechat.library.bean.ticket.TicketResult;
import com.techblor.wechat.library.util.HttpClientUtil;

/**
 * 票据接口
 */
public class TicketApi extends WechatApi {

    /**
     * 获取公众号调用微信JS接口的临时票据
     *
     * @param access_token
     * @return
     */
    public TicketResult getTicket(String access_token) {
        String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + access_token + "&type=jsapi";

        String result = HttpClientUtil.doGet(url);
        return JSON.parseObject(result, TicketResult.class);
    }

}
